import { message } from "antd";
import Mock from "mockjs";

const PermissionApi = {
  LoginApi: (config) => {
    const { username, password } = JSON.parse(config.body);
    //先判断用户是否存在
    //判断账号和密码是否对应
    if (username === "admin" && password === "admin") {
      return {
        code: 200,
        data: {
          token: Mock.Random.guid(),
          message: "登录成功",
        },
      };
    } else if (username === "account" && password === "account") {
      return {
        code: 200,
        data: {
          token: Mock.Random.guid(),
          message: "登录成功",
        },
      };
    } else {
      return {
        code: 400,
        message: "登录失败",
      };
    }
  },
};

export default PermissionApi;
